<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <title>@bugsnag/web-worker: Web Worker example</title>
  <link rel="stylesheet" type="text/css" href="/index.css" />
  <script src="//d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js"></script>
  <script>Bugsnag.start('YOUR_API_KEY')</script>
</head>
<body>
  <img width="100" src="/bugsnag.png"/>
  <h1>Web and service worker example</h1>
  <p>This an example of how to include <code>@bugsnag/web-worker</code> in a web worker and a service worker.</p>
  <h3>
    This app has 2 web workers and 1 service worker. 1 web worker leaves unhandled errors to propagate to the browser context
    and be reported here, while the other has propagation disabled and reports its own unhandled errors.
  </h3>
  <p>
    You can unregister the current service worker by pressing the 'Unregister' button.
    Simply refresh the page to instantiate the new service worker.
  </p>
  <section>
    <div>
      <h2>Web Worker with Propagation</h2>
      <button id="handledErrorWebWrkrProp">Throw handled error</button>
      <button id="unhandledErrorWebWrkrProp">Throw unhandled error</button>
    </div>
    <div>
      <h2>Web Worker without Propagation</h2>
      <button id="handledErrorWebWrkrNoProp">Throw handled error</button>
      <button id="unhandledErrorWebWrkrNoProp">Throw unhandled error</button>
    </div>
    <div>
      <h2>Service Worker</h2>
      <button id="handledErrorServWrkr">Throw handled error</button>
      <button id="unhandledErrorServWrkr">Throw unhandled error</button>
      <button id="unregister">Unregister</button>
    </div>  
  </section>

  <script src="service-worker-registration.js"></script>
  <script src="worker-registration.js"></script>
  
</body>
</html>
